import request from "@/utils/request";

enum API {
    C1_URL = '/admin/product/getCategory1',
    C2_URL = '/admin/product/getCategory2/',
    C3_URL = '/admin/product/getCategory3/',
    ATTR_URL = '/admin/product/attrInfoList/',
    ADDORUPDATEATTR_URL = '/admin/product/saveAttrInfo',
    DELETEATTR_URL = '/admin/product/deleteAttr/'
}

// 获取一级分类的接口
export const reqC1 = () => request.get<any, any>(API.C1_URL)

// / 获取二级分类的接口
export const reqC2 = (category1Id: any) => request.get<any, any>(API.C2_URL + category1Id)

// / 获取三级分类的接口
export const reqC3 = (category2Id: any) => request.get<any, any>(API.C3_URL + category2Id)

// 获取对应分类学已有的属性和属性值接口
export const reqAttr = (category1Id: any, category2Id: any, category3Id: any) => request.get<any, any>(API.ATTR_URL + `${category1Id}/${category2Id}/${category3Id}`)

// 新增获取修改已有属性的接口
export const reqAddOrUpdateAttr = (data: any) => request.post<any, any>(API.ADDORUPDATEATTR_URL, data)

// 删除已有属性的方法
export const reqRemoveAttr = (attrId: any) => request.delete<any, any>(API.DELETEATTR_URL + attrId)




































